package com.qidian.mes.machine.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.machine.service.MachineTypeService;
import com.qidian.mes.pojo.MachineType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.crypto.Mac;

/**
 * @Author 任超
 * Time 2024/10/15 19:42
 */
@RestController
@RequestMapping("/machine")
@CrossOrigin
public class MachineTypeController {

    @Autowired
    private MachineTypeService machineTypeService;

    @GetMapping("/list")
    public MESResult list(int parentId){
        return machineTypeService.list(parentId);
    }

    @GetMapping("/queryList")
    public MESResult queryList(MachineType machineType){
        return machineTypeService.queryList(machineType);
    }

    @PutMapping("/add")
    public MESResult add(@RequestBody MachineType machineType){
        return machineTypeService.addMachineType(machineType);
    }

    @PutMapping("/updateTypeParent")
    public MESResult updateTypeParent(Long typeId){
        return machineTypeService.updateRowTypeParent(typeId);
    }

    @PutMapping("/updateType")
    public MESResult updateMachineType(@RequestBody MachineType machineType){
        return machineTypeService.updateMachineType(machineType);
    }

    @GetMapping("/selectById")
    public MESResult selectById(Long typeId){
        return machineTypeService.selectById(typeId);
    }

    @PutMapping("/updateTypeStatus")
    public MESResult updateMachineTypeId(Long typeId){
        return machineTypeService.updateMachineTypeStatus(typeId);
    }
}
